package com.ruoyi.Electronic.service.impl;

import com.ruoyi.Electronic.domain.HouseRepairElectronicT;
import com.ruoyi.Electronic.mapper.HouseRepairElectronicMapper;
import com.ruoyi.Electronic.service.IHouseRepairElectronicService;
import com.ruoyi.common.core.domain.entity.SysDictData;
import com.ruoyi.system.mapper.SysDictDataMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class HouseRepairElectronicServiceImlp implements IHouseRepairElectronicService {
    @Autowired
    private HouseRepairElectronicMapper houseRepairElectronicMapper;
    @Autowired
    private SysDictDataMapper dictDataMapper;

    @Override
    public List<HouseRepairElectronicT> getGroupListAll(HouseRepairElectronicT houseRepairElectronicT) {
        return houseRepairElectronicMapper.getGroupListAll(houseRepairElectronicT);
    }

    @Override
    public List<HouseRepairElectronicT> selectAnnexList(HouseRepairElectronicT houseRepairElectronicT) {
        return houseRepairElectronicMapper.selectAnnexList(houseRepairElectronicT);
    }

    @Override
    public List<HouseRepairElectronicT> getUnitListAll(HouseRepairElectronicT houseRepairElectronicT) {
        return houseRepairElectronicMapper.getUnitListAll(houseRepairElectronicT);
    }

    @Override
    public List<HouseRepairElectronicT> getDoorList(HouseRepairElectronicT houseRepairElectronicT) {
        return houseRepairElectronicMapper.getDoorList(houseRepairElectronicT);
    }

    @Override
    public List<HouseRepairElectronicT> getDoorByRepairList(HouseRepairElectronicT houseRepairElectronicT) {
        return houseRepairElectronicMapper.getDoorByRepairList(houseRepairElectronicT);
    }

    @Override
    public HouseRepairElectronicT getMaxDate(HouseRepairElectronicT houseRepairElectronicT) {
        return houseRepairElectronicMapper.getMaxDate(houseRepairElectronicT);
    }

    @Override
    public HouseRepairElectronicT areaInfoSelect(HouseRepairElectronicT houseRepairElectronicT) {
        return houseRepairElectronicMapper.areaInfoSelect(houseRepairElectronicT);
    }

    @Override
    public HouseRepairElectronicT getGroupSum(HouseRepairElectronicT houseRepairElectronicT) {
        return houseRepairElectronicMapper.getGroupSum(houseRepairElectronicT);
    }

    @Override
    public HouseRepairElectronicT getHouseDoorTsum(HouseRepairElectronicT houseRepairElectronicT) {
        return houseRepairElectronicMapper.getHouseDoorTsum(houseRepairElectronicT);
    }
	
	@Override
    public int insertElectronicPhoto(HouseRepairElectronicT houseRepairElectronicT) {
        int i = 0;
        for(String photo:houseRepairElectronicT.getPhotoList()){
            houseRepairElectronicT.setElectronicHttp(photo);
            SysDictData dictData = new SysDictData();
            dictData.setDictType("REPAIR004");
            List<SysDictData> list = dictDataMapper.selectDictDataList(dictData);
            for(SysDictData sysDict:list){
                if(houseRepairElectronicT.getFileType().equals(sysDict.getDictValue())){
                    houseRepairElectronicT.setElectronicName(sysDict.getDictLabel());
                }
            }
            i =houseRepairElectronicMapper.insertElectronicPhoto(houseRepairElectronicT);
        }
        return i;
    }
}
